home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 410_01 / wlist / makefile < prev    next >
Encoding:
Makefile  |  1995-12-30  |  6.5 KB  |  229 lines

  1. #  @(#)Makefile.
  2. #
  3. #    Makefile for 
  4. #
  5. #    PROGRAM(s)  :
  6. #    LIBRARY(s)  : libwlist.a
  7. #    AUTHOR        : W. Hatch
  8. #            Coleman Research
  9. #              9891 Broken Land Parkway
  10. #              Suite 200
  11. #              Columbia, Maryland 21045
  12. #              Phone (301)621-8600
  13. #              FAX (410)7210
  14. #            uunet!bts!bill
  15. #    DATE        : Sun Jan 30 18:46:21 EST 1994
  16. #    PROJECT        : WEH Software
  17. #
  18. #    This Makefile template assumes that the following shell scripts
  19. #    are installed in one of the user's PATH directories
  20. #
  21. #        sccs_admin  arg1  arg2  ...
  22. #        sccs_get   arg1  arg2  ...
  23. #        sccs_delta arg1  arg2  ...
  24. #        sccs_edit  arg1  arg2  ...
  25. #
  26. #    where arg1  arg2  ....  are the names of SRC, and HEADERS
  27. #    files on which the sccs operations will be performed.
  28. #
  29. #    These scripts are used to "hide" the differences between System V.3
  30. #    and BSD 4.3 SCCS utility interfaces.
  31. #
  32. #--------------------------------------------------------------------------
  33.  
  34. #--------------------------------------------------------------------------
  35. #  1. define symbolic constants
  36. #
  37. #    directory containing general header files
  38. INCLUDE=-I. -I$(LOCAL)/include -I$(SYSINCLUDE)
  39. #
  40. #    relocatable library to be created
  41. LIB=libwlist.a
  42. #
  43. #    list of header files, subject to change, on which *.o depend
  44. HEADERS=tstring.h wlist.h
  45. #
  46. #    list of source files to be compiled
  47. SRC= node.cc tstring.cc wlist.cc
  48. #
  49. #    list of object files to be linked
  50. OBJ= node.o tstring.o wlist.o
  51. #
  52. #
  53. #    compile options
  54. #    gcc
  55. CC=$(CPLUS)
  56. AS=$(CC)
  57. LD=$(CC)
  58. STRIP=strip
  59. RANLIB=ranlib
  60. CFLAGS=-c $(INCLUDE) $(OFLAGS) # add -O after checkout
  61. #
  62. LFLAGS=
  63. #
  64. #    list of all junk files that might occur in this directory
  65. JUNK=core a.out JOURNAL LINT paste.txt error.log dbg_jnl* CHECK CCHK CFLOW \
  66.     MCCABE KDSI *PRINT GLINT CXREF TJ *.s tr.*
  67. #--------------------------------------------------------------------------
  68. #  2. link and load to create the executable, $(LIB) must be deleted and
  69. #     recreated using the sorted object files
  70. #
  71. #     CHOOSE ONE OF THE FOLLOWING DEPENDENCIES
  72. #--------------------------------------------------------------------------
  73. $(LIB):  $(OBJ) 
  74.     rm -f $(LIB)
  75.     ar crv $(LIB) $(OBJ)
  76.  
  77. testwl: maintest.o $(LIB)
  78.     $(CC) -o testwl maintest.o $(LIB) $(LIB)
  79. #--------------------------------------------------------------------------
  80. #  3. install all objects of this make
  81. #--------------------------------------------------------------------------
  82. install:  $(LIB)
  83.     RANLIB $(LIB)
  84.     cp $(LIB) $(LIBDIR)
  85.     rm -f $(LIB)
  86.  
  87. #--------------------------------------------------------------------------
  88. #  4. initialize SCCS administration of the source files
  89. #--------------------------------------------------------------------------
  90. admin:
  91.     sccs_admin  $(SRC) $(HEADERS) $(SCRIPT) $(MANPAGES)
  92.  
  93.  
  94. #--------------------------------------------------------------------------
  95. #  5. lint for syntax check on all C source, headers
  96. #     use g++ for most comprehensive syntax checking
  97. #--------------------------------------------------------------------------
  98. lint:  $(SRC)  $(HEADERS)
  99.     g++  $(SRC) $(CFLAGS) 2>LINT
  100.  
  101. #--------------------------------------------------------------------------
  102. #  6. tidy up by getting rid of all junk files
  103. #--------------------------------------------------------------------------
  104. tidy:
  105.     rm -f $(JUNK)
  106.  
  107. #--------------------------------------------------------------------------
  108. #  7. clean up by removing all vestiges of previous makes
  109. #--------------------------------------------------------------------------
  110. clean:  tidy 
  111.     rm -f $(TEST)
  112.     rm -f $(LIB)
  113.     rm -f *.o
  114.  
  115. #--------------------------------------------------------------------------
  116. #  8. uninstall all installed targets of this make
  117. #--------------------------------------------------------------------------
  118. uninstall:  clean
  119.     rm -f $(LIBDIR)/$(LIB)
  120.     for i in $(MANPAGES); do; \
  121.         rm -f $(MAN3)/$$i; \
  122.     done
  123.  
  124. #--------------------------------------------------------------------------
  125. #  9. individual dependencies for C source files as per the following 
  126. #     example:
  127. #
  128. #    foobar.c:  SCCS/s.foobar.c
  129. #        sccs_get foobar.c
  130. #
  131. #--------------------------------------------------------------------------
  132.  
  133. #--------------------------------------------------------------------------
  134. #  10.  individual dependencies for relocatable object files as per
  135. #    the following example:
  136. #
  137. #    foobar.o:  foobar.c  $(HEADERS)
  138. #        cc -O -c foobar.c
  139. #
  140. #--------------------------------------------------------------------------
  141. .SUFFIXES: .o .cc 
  142. .cc.o:
  143.     $(CC) $(CFLAGS) $<
  144.  
  145. FFLAGS= -C++ -c -r8
  146.  
  147. .SUFFIXES: .P .f
  148. .f.P:
  149.     cp $*.f tmp.f
  150.     f2c -P $(FFLAGS) tmp.f
  151.     echo "#ifdef __cplusplus" > $*.P
  152.     echo "extern \"C\" {"    >> $*.P
  153.     echo "#endif" >> $*.P
  154.     cat tmp.P >> $*.P
  155.     echo "#ifdef __cplusplus" >> $*.P
  156.     echo "}"    >> $*.P
  157.     echo "#endif" >> $*.P
  158.     rm -f tmp.P
  159.  
  160. .SUFFIXES: .c .f
  161. .f.c: 
  162.     cp $*.f tmp.f
  163.     f2c  $(FFLAGS) tmp.f
  164.     echo "#include <f2c.h>" >$*.c
  165.     echo "#include <$*.P>" >> $*.c
  166.     cat tmp.c >> $*.c
  167.     rm tmp.c tmp.f
  168.  
  169. #--------------------------------------------------------------------------
  170. #  11. individual dependencies for shell script and manual pages
  171. #      as per the following example:
  172. #
  173. #    textfile: SCCS/s.textfile
  174. #        sccs_get textfile
  175. #    or
  176. #
  177. #    $(SRC): 
  178. #        sccs_install $(SRC)
  179. #
  180. #--------------------------------------------------------------------------
  181. wlist.o: wlist.cc wlist.h 
  182.  
  183. node.o: node.cc wlist.h
  184.  
  185. tstring.o: tstring.cc tstring.h
  186.  
  187. maintest.o: maintest.cc tstring.h wlist.h
  188.  
  189. #--------------------------------------------------------------------------
  190. #  12. edit - get all of the source files ready to edit
  191. #--------------------------------------------------------------------------
  192. edit:
  193.     sccs_edit $(SRC)  $(HEADERS) $(TESTSRC)
  194.  
  195. #--------------------------------------------------------------------------
  196. #  13. get - get all of source files in read only form
  197. #--------------------------------------------------------------------------
  198. get:
  199.     sccs_get  $(SRC)  $(HEADERS) $(TESTSRC)
  200.  
  201. #--------------------------------------------------------------------------
  202. #  14. delta - SCCS delta all source
  203. #--------------------------------------------------------------------------
  204. delta:
  205.     sccs_delta  $(SRC)  $(HEADERS) $(TESTSRC)
  206.  
  207. $(SRC): 
  208.     sccs_install $(SRC)
  209.  
  210. #--------------------------------------------------------------------------
  211. # 14. print all source files
  212. #--------------------------------------------------------------------------
  213. print: $(SRC) $(HEADERS) cover
  214.     srcpub $(HEADERS) $(SRC) Makefile >PRINT
  215.     trmm PRINT
  216.     offjet tr.PRINT
  217.  
  218. cover:
  219.     sed "s/LIBX/$(LIB)/" ../cover > cover
  220.     trmm cover
  221.     offjet tr.cover
  222.  
  223. summary: $(SRC)  $(HEADERS)
  224.     srcpub $(HEADERS) |sed '/^\.TC/,/^\.ds Lt/d' >PRINT
  225.     echo ".bp" >> PRINT
  226.     exsum $(SRC) | sed '1,/^\.PF/d' >>PRINT
  227.  
  228.  
  229.